# -*- coding: utf-8 -*-
# TencentBlueKing is pleased to support the open source community by making
# 蓝鲸智云 - PaaS 平台 (BlueKing - PaaS System) available.
# Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the MIT License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
#     http://opensource.org/licenses/MIT
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific language governing permissions and
# limitations under the License.
#
# We undertake not to change the open source license (MIT license) applicable
# to the current version of the project delivered to anyone in the future.

# Generated by Django 3.2.12 on 2022-11-15 03:28

from django.db import migrations, models
import django.db.models.deletion
import paasng.bk_plugins.pluginscenter.constants
import paasng.bk_plugins.pluginscenter.models.definitions


class Migration(migrations.Migration):

    dependencies = [
        ('pluginscenter', '0005_auto_20221101_1757'),
    ]

    operations = [
        migrations.CreateModel(
            name='PluginConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('unique_key', models.CharField(max_length=64, verbose_name='唯一标识')),
                ('row', models.JSONField(default=dict, verbose_name="配置内容(1行), 格式 {'column_key': 'value'}")),
            ],
        ),
        migrations.CreateModel(
            name='PluginConfigInfoDefinition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('title', models.CharField(max_length=16, verbose_name='「配置管理标题」')),
                (
                    'sync_api',
                    paasng.bk_plugins.pluginscenter.models.definitions.PluginBackendAPIResourceField(null=True),
                ),
                (
                    'columns',
                    paasng.bk_plugins.pluginscenter.models.definitions.PluginConfigColumnDefinitionField(default=list),
                ),
                (
                    'pd',
                    models.OneToOneField(
                        db_constraint=False,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='config_definition',
                        to='pluginscenter.plugindefinition',
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AlterField(
            model_name='plugininstance',
            name='status',
            field=models.CharField(
                choices=[
                    ('waiting-approval', '创建审批中'),
                    ('approval-failed', '创建审批失败'),
                    ('developing', '开发中'),
                    ('releasing', '发布中'),
                    ('released', '已发布'),
                ],
                default=paasng.bk_plugins.pluginscenter.constants.PluginStatus['WAITING_APPROVAL'],
                max_length=16,
                verbose_name='插件状态',
            ),
        ),
        migrations.DeleteModel(
            name='PluginMembership',
        ),
        migrations.AddField(
            model_name='pluginconfig',
            name='plugin',
            field=models.ForeignKey(
                db_constraint=False,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='configs',
                to='pluginscenter.plugininstance',
            ),
        ),
        migrations.AlterUniqueTogether(
            name='pluginconfig',
            unique_together={('plugin', 'unique_key')},
        ),
    ]
